<!-- 新闻列表 -->
<template>
    <div class="page-box h100 display-flex czbj">
      <div>
        <dxtable
        :headBtn="headBtn"
          :dataJson="dataJson"
          :portUrl="portUrl"
          :qx="qx"
          ref="databale"
          sonRouter="bjnewsTrends"
        ></dxtable>
      </div>
    </div>
  </template>
   <script lang='ts' setup>
  import dxtable from "../../../components/util/dxtable.vue";
  import sort from "../../../components/util/sort.vue";
  import { dxget, dxpost, qurl, hf } from "../../../util/index";
  import { h, ref, reactive } from "vue";
  import {types  } from "../public/index";
  const props = defineProps({
  pup: { type: String },
});
let headBtn = [];
  const databale = ref();
  const initeer = () => {
    databale.value.initDataExpose();
  };
  const emit = defineEmits(["callBack"]);
  // 弹窗公用该列表
  let dataJson = reactive([
  
  {
      title: "封面",
      width:150,
      render(row) {
        return  h('img',{src:row.cover,class:'fm-context'})
      }
    },
    {
      title: "新闻名称",
      key: "title",
      placeholder:"输入新闻名称",
      search: true, // 是否在搜索栏展示
    },
    {
      title: "类型",
      key: "classify",
      type: "select",
      options: [],
      width:200,
      render(row) {
        return  types.filter(a=>a.value==row.classify)[0].label
      }
    },
    // {
    //   title: "发布者",
    //   key: "publisher",
    //   options: [],
    //   width:200,
    // },
    {
      title: "排序",
      width: 100,
      render(row) {
        row.databaseName = "djnewsTrends";
        return h(sort, {
          row,
          onCallBack: () => {
            initeer();
          },
        });
      },
    },
    {
      title: "创建时间",
      key: "addTime",
      width: "200",
      type: "daterange",
    },
  ]);
  let portUrl = "djhs/djnewsTrends";
  const qx = {
    DeletePermissionID: "newsTrendsdel", //删除
    EditPermissionIdentifier: "newsTrendsbj", // 编辑
    NewPermissionIdentifier: "newsTrendsxz", // 新建
    ViewPermissionID: "newsTrendsck", // 查看
  };
  

  let pupVal = props.pup;
if (pupVal) {
  headBtn = [
    {
      name: "确认选择 ",
      async clickFun(row) {
        const arrList = row.join(",");
        emit("callBack",arrList);
      },
    },
  ];
}
  </script>
  
  
  